<%@page pageEncoding="UTF-8"%>

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib prefix="s" uri="/struts-tags"  %> 
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<%@ page import="com.appsindy.reserv.ReservConstants" %>

<html> 
<head>
<sx:head parseContent="true"/>
<title>Reserve By</title>
<meta http-equiv="Pragma" content="text/html; charset=UTF-8" content="no-cache">

<link rel="stylesheet" href="css/demo_page.css" media="screen"></link>
<link rel="stylesheet" href="css/demo_table.css" media="screen"></link>
<style type="text/css">
	.button { width: 80px;}
	.list { width: 200px; }
	body {
		padding: 10px 5px 15px 5px;
	}
</style>

<script type="text/javascript">            
<!--
	window.focus();
		if (!window.opener)
			window.document.write();
	
	var openerObj = window.opener;

	function submitData() {	
		var dateFromObj 	= document.getElementById("dateFromPopup");
		var dateToObj 		= document.getElementById("dateToPopup");
		var groupObj 		= document.getElementById("groupPopup");
	
		var valGroupId		= groupObj.value;
		if(document.getElementsByName("choose")[0].checked){
			if(groupObj.value == "0"){
				alert("Please choose group");
				groupObj.select();
				return;
			}
		} else if(document.getElementsByName("choose")[1].checked){
			groupObj.options[0].selected = true;
			valGroupId			= '<%=ReservConstants.GroupId4Customer%>';
		}
		
		var opennerForm = openerObj.frmReserveInfo;
		opennerForm.dateFromPopup.value 	= dateFromObj.value;
		opennerForm.dateToPopup.value		= dateToObj.value;
		opennerForm.groupPopup.value 		= valGroupId;
		openerObj.toReserveInfo();
		window.close();
	}
//-->
</script>
</head>
 
<body background="images/top_page_bg.jpg">

<s:form id="frmReservePopup" action="reserveOverview_toReserveByPopup.action" method="POST" theme="simple">
<table cellpadding="5" cellspacing="0" border="0" width="100%" align="center" style="background-color:white; border:solid 1px #5AAAFA">
<tr>
	<td>
		<input type="radio" name="choose" value="group" />
	</td>
	<td>
		<s:label key="reserve.dialog.choose.group" />
	</td>
	<td>
		<s:select id="groupPopup" name="groupPopup" list="%{groupPopupList}" listKey="key" listValue="value" headerKey="0" headerValue="--Select--"/>								
	</td>
</tr>
<tr>
	<td>
		<input type="radio" name="choose" value="customer" checked="checked" />
	</td>
	<td>
		<s:label key="reserve.dialog.choose.customer" />
	</td>
</tr>
<tr>
	<td align="center" colspan="3">
		<s:hidden id="dateFromPopup" name="dateFromPopup" />
		<s:hidden id="dateToPopup" name="dateToPopup" />
    	<input type="button" value="<s:text name="reserve.dialog.choose.ok" />" class="button" onclick="submitData()" id="btnOk" />
		<input type="button" value="<s:text name="reserve.dialog.choose.cancel" />" onclick="window.close()" class="button" />
		<img id="reserveByIndicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="visibility:hidden"/>  
	</td>
</tr>
</table>
</s:form>
 
</body>
</html>
